<!DOCTYPE html>
<html lang="en">
<!--header-->
<include file="Public:header"/>
<!--header-->
<style>
    input{
        width:80px;
    }
</style>
<section id="main-content">
    <section class="wrapper">
        <h3><i class="fa fa-angle-right"></i> 教师信息</h3>
        <div class="row mt">
            <div class="col-md-12">
                <div class="content-panel">
                    <table class="table table-striped table-advance table-hover">
                        <h4><i class="fa fa-angle-right"></i> 教师信息列表
                            <a onclick="tian()" href="javascript:void(0)" class="btn btn-theme btn-default" style="margin-left: 40px">添加新教师</a>
                        </h4>
                        <hr>
                        <thead>
                        <form class="form-inline" role="form" action="{:U('index')}" method="post">
                            <select class="btn btn-theme04" name="sou"  style="width: 140px;float: left;margin-left: 20px;">
                                <option value="1">所属类别</option>
                                <option value="2">名称</option>
                                <option value="3">标题</option>
                                <option value="4">价格</option>
                                <option value="5">库存</option>
                            </select>
                            <div class="form-group" style="width: 300px;float: left;overflow: hidden;margin-left: 10px;margin-right: 10px">
                                <input type="text" name="content" class="form-control"  placeholder="请输入关键字" style="float: left;text-align: center">
                            </div>
                            <input type="hidden" name="type_id" value="{$lei.id}">
                            <input type="hidden" name="store_name" value="{$st.store_name}">
                            <input type="submit" class="btn btn-theme" value="搜索" style="float: left" />
                        </form>
                        <tr>
                            <th>编号</th>
                            <th>展示图</th>
                            <th>头像</th>
                            <th>教师标签/类别</th>
                            <th>教师姓名</th>
                            <th>教师电话</th>
                            <th>介绍</th>
                            <th>推荐状态</th>
                            <th>修改时间</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <volist name="list" id="v">
                            <tr>
                                <td>{$v.id}</td>
                                <td>
                                    <if condition = "$v['banner'] == NULL">
                                        <a  title="暂无图" class="fancybox" href="__PUBLIC__/img/wutu.png">
                                            <img class="img-responsive" src="__PUBLIC__/img/wutu.png" style="width: 60px;height: 60px;border-radius: 50%">
                                        </a>
                                        <else/>
                                        <a class="fancybox" href="{$v.banner}">
                                            <img class="img-responsive" src="{$v.banner}" style="width: 60px;height: 60px;border-radius: 50%">
                                        </a>
                                    </if>
                                </td>
                                <td>
                                    <if condition = "$v['avatar'] == NULL">
                                        <a  title="暂无图" class="fancybox" href="__PUBLIC__/img/wutu.png">
                                            <img class="img-responsive" src="__PUBLIC__/img/wutu.png" style="width: 60px;height: 60px;border-radius: 50%">
                                        </a>
                                        <else/>
                                        <a class="fancybox" href="{$v.avatar}">
                                            <img class="img-responsive" src="{$v.avatar}" style="width: 60px;height: 60px;border-radius: 50%">
                                        </a>
                                    </if>
                                </td>
                                <td>{$v.tags}</td>
                                <td>{$v.name}</td>
                                <td>{$v.phone}</td>
                                <td><input type="text" value="{$v.intro}" title="{$v.intro}"></td>
                                <td>
                                    <if condition = "$v['tui'] == 1">
                                        不推荐
                                        <else/>
                                        <span style="color: red;">推荐中</span>
                                    </if>
                                </td>
                                <td><if condition="$v['up_at'] != NULL">{$v.up_at|date="Y-m-d",###}<else/>无</if></td>
                                <td>{$v.create_at|date="Y-m-d",###}</td>
                                <td>
                                    <a  title="修改" href="{:U('form',array('id'=>$v['id'],'currpage'=>$currpage))}"
                                        class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></a>
                                    <if condition="QUAN eq 2">
                                        <button  title="删除课程" onclick="del({$v.id},4)" class="btn btn-danger btn-xs"><i class="fa fa-trash-o"></i></button>
                                    </if>
                                </td>
              <!-- <if condition="$v.vedios eq NULL">
                        <thead>
                        <tr>
                            <th></th><th></th><th></th>
                            <th></th>
                            <th></th>
                            <th> 暂无优惠信息</th>
                            <th></th>
                            <th></th>
                        </tr>
                        </thead>
                <else/>
                        <thead>
                        <tr>
                            <th></th><th></th><th></th>
                            <th>课程编号</th>
                            &lt;!&ndash;<th>课程名称</th>&ndash;&gt;
                            <th>外链</th>
                            <th>语音</th>
                            &lt;!&ndash;<th>课时</th>&ndash;&gt;
                            <th>是否收费</th>
                            <th>修改时间</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <volist name="v.vedios" id="vv">
                            <tr>
                                <td></td><td></td><td></td>
                                <td>{$vv.id}</td>
                                &lt;!&ndash;<td>{$vv.title}</td>&ndash;&gt;
                                <td>{$vv.url}</td>
                                <td>
                                    {$vv.voice}
                                    &lt;!&ndash;<embed height="100" width="100" src="{$vv.voice}" />&ndash;&gt;
                                </td>
                                &lt;!&ndash;<td>{$vv.ke_time}</td>&ndash;&gt;
                                <td>
                                    <if condition="$vv.status eq 1">收费</if>
                                    <if condition="$vv.status eq 2">免费</if>
                                </td>
                                <td><if condition="$vv['up_at'] != NULL">{$vv.up_at|date="Y-m-d H:i:s",###}<else/>无</if></td>
                                <td>{$vv.create_at|date="Y-m-d H:i:s",###}</td>
                                <td>
                                    <a  title="修改" href="{:U('forms',array('id'=>$vv['id'],'currpage'=>$currpage))}"
                                        class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></a>
                                    <if condition="QUAN eq 2">
                                        <button  title="删除课程" onclick="del({$vv.id},5)" class="btn btn-danger btn-xs"><i class="fa fa-trash-o"></i></button>
                                    </if>
                                </td>
                            </tr>
                        </volist>
                </if>-->
                </tr>
                        </volist>
                        </tbody>
                    </table>
                    <form action="{:U('index')}" method="post" name="frmss">
                        <div  style="margin: 0 auto;width: 800px;margin-bottom: 20px">
                            <if condition="$currpage == 1">
                                    <span class="badge" style="font-size: 15px">
                                        首页
                                    </span>
                                <span class="badge" style="font-size: 15px">
                                        上一页
                                    </span>
                                <else/>
                                <span class="badge" style="font-size: 15px">
                                        <a href="{:U('index',array('tt'=>$lei['id'],'currpage'=>1))}" style="color: #ffffff">首页</a>
                                    </span>
                                <span class="badge" style="font-size: 15px">
                                        <a href="{:U('index',array('tt'=>$lei['id'],'currpage'=>$currpage-1))}" style="color: #ffffff">上一页</a>
                                    </span>
                            </if>
                            <if condition="$currpage == $totalpage">
                                    <span class="badge" style="font-size: 15px">
                                        下一页
                                    </span>
                                <span class="badge" style="font-size: 15px">
                                        尾页
                                    </span>
                                <else/>
                                <span class="badge" style="font-size: 15px">
                                        <a href="{:U('index',array('tt'=>$lei['id'],'currpage'=>$currpage+1))}" style="color: #ffffff">下一页</a>
                                    </span>
                                <span class="badge" style="font-size: 15px">
                                        <a href="{:U('index',array('tt'=>$lei['id'],'currpage'=>$totalpage))}" style="color: #ffffff">尾页</a>
                                    </span>
                            </if>
                            <span class="badge" style="font-size: 15px">
                                    当前第 {$currpage} 页；共 {$totalpage} 页
                                </span>
                            <span class="badge" style="font-size: 15px">
                                    跳转到
                                <input type="hidden" name="tt" value="{$lei.id}">
                                <input type="text" name="currpage" style="width: 50px;height:18px;border-radius: 5px;color: black;text-align: center;margin-left: 4px;margin-right: 8px">页
                                <button id="tiao" style="color: #888888;width: 50px;height:18px;border-radius: 8px;margin: auto 0;border: none">确定</button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</section>

</section>
<!--footer-->
<include file="Public:footer"/>
<!--footer-->
<script type="text/javascript" src="__PUBLIC__/ui/lib/layer/2.4/layer.js"></script>
<script type="text/javascript">
    $(function() {
        //    fancybox
        jQuery(".fancybox").fancybox();
    });
</script>
<script>
    function tian() {
        location.href="__APP__/Dashboard/Teacher/form";
        /*if(confirm("这里写成弹出层，选择医疗或者生活美容")){

        }*/
    }
    //custom select box
    $(function(){
        $('select.styled').customSelect();
    });
    //跳转页数检测
    $("#tiao").click(function () {
        if(document.frmss.currpage.value == "" || document.frmss.currpage.value > {$totalpage} || document.frmss.currpage.value < 1){
            return false;
        }
    })
    function del(id,type) {
        console.log(id,type);
        var currpage = "{$currpage}";
        if(id > 0){
           layer.confirm('确认要删除该课程吗？删除将删除以该课程有关的所有信息！', {
                title: '删除提示：',
                btn: ['确定'] //可以无限个按钮
            }, function(index, layero){
                $.ajax({
                    type:"post",
                    data:{id:id,type:type},
                    url:"{:U('Del/del')}",
                    success:function (res) {
                        alert(res.status)
                        if(res.status == 1){
                            layer.open({
                                title: '',
                                content: "操作成功",
                            });
                            if(currpage == 1){
                                location.href="__APP__/Dashboard/Voices/index";
                            }else{
                                location.href="__APP__/Dashboard/Voices/index/currpage/"+currpage;
                            }
                        }
                        if(res.status == 2){
                            layer.open({
                                title: ''
                                ,content: "操作失败"
                            });
                            _pass = false;
                        }
                    }
                })
            });
        }
    }
</script>

</body>
</html>
